package com.alone.mybatisplus.datascope.core.domain;

import lombok.EqualsAndHashCode;
import lombok.Getter;

/**
 * @author Alone
 */
@Getter
@EqualsAndHashCode(callSuper = true)
public class SqlDataScope extends DataScope {

    private final String sql;

    private SqlDataScope(String sql) {
        super(false);
        this.sql = sql;
    }

    public static SqlDataScope of(String sql) {
        return new SqlDataScope(sql);
    }

    @Override
    public String getRenderedSql(String orgSql) {
        return String.format(sql, orgSql);
    }

}
